/*
 ============================================================================
 Name        : bai21.c
 Author      : cuongpq
 Version     :
 Copyright   : Your copyright notice
 Description : Hello World in C, Ansi-style
 ============================================================================
 */

#include <stdio.h>
#include <stdlib.h>

int a[100];
int k,n;

void readInput(int *a, int *n, int *k){
	FILE *pf;
	int i, nn, kk, temp;
	
	pf = fopen("INPUT.TXT","r");
	fscanf(pf,"%d%d",&nn,&kk);	
	*n = nn;
	*k = kk;	
	for (i=1; i<=nn; i++){
		fscanf(pf,"%d",&temp);
		a[i] = temp;
	}
	
	fclose(pf);
}

int NPKeTiep(int* bit, int n){
	int i, j;
	i = n;
	while ((bit[i] == 1) && (i>0)) i--;
	if (i == 0) return 0;
	bit[i] = 1;
	for (j = i+1; j<=n; j++) bit[j] = 0;
	return 1;
}
void writeOutput(int kq[100][100], int c, int n){
	FILE *fp;
	int i, j;
	fp = fopen("OUTPUT.TXT","w");
	for (i = 1; i<=c; i++){
		for (j=1; j<=n; j++) {
			if (kq[i][j] == 1) fprintf(fp,"%d ",a[j]);
		}
		fprintf(fp,"\n");
	}
	fclose(fp);
}

int main(void) {
	int i, sum;
	int bit[100];
	int kq[100][100];
	int c = 0;
	readInput(a, &n, &k);
	for (i=1; i<=n; i++) {
		bit[i] = 0;
	}
	while (NPKeTiep(bit, n) == 1){
		sum = 0;
		for (i=1; i<=n; i++){
			if (bit[i] == 1){
				sum = sum + a[i];
			}
		}
		if (sum == k){
			c++;
			for (i=1; i<=n; i++) kq[c][i] = bit[i]; 
		}
	}
	printf("%d",c);
	writeOutput(kq, c, n);
	return 0;
}
